#include "widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
    Cbtn1 = new QCheckBox("注册");
    Cbtn2 = new QCheckBox("注销");

    QVBoxLayout *layout=new QVBoxLayout;
    layout->addWidget(Cbtn1);
    layout->addWidget(Cbtn2);
    this->setLayout(layout);
    this->resize(400,400);
    this->setWindowTitle("demo");
    connect(Cbtn1,&QCheckBox::stateChanged,[](){
        QWidget *widget= new QWidget();
        QLabel *label= new QLabel("现在不让注册了",widget);
        widget->resize(150,150);
        widget->setWindowTitle("提示");
        //文字居中
        label->setAlignment(Qt::AlignCenter);
        QVBoxLayout *layout=new QVBoxLayout(widget);
        layout->addWidget(label);
        widget->show();
    });
    connect(Cbtn2,&QCheckBox::stateChanged,[](){
        QWidget *widget= new QWidget();
        QLabel *label= new QLabel("现在不让注销了",widget);
        widget->resize(150,150);
        widget->setWindowTitle("提示");
        //文字居中
        label->setAlignment(Qt::AlignCenter);
        QVBoxLayout *layout=new QVBoxLayout(widget);
        layout->addWidget(label);
        widget->show();
    });
}

Widget::~Widget()
{
}

